package info.rodinia.tokenmaker;

import java.util.ArrayList;

/** 
 * Ritual models D&D 4E rituals.  
 * All I'm really doing here is keeping an HTML representation of the ritual on the token for ease of look up during the game.
 * @author Blakey - Summer 2010
 *
 */
public class Ritual {
    // compendium info
    private int id = 0;
    private String html = null;
    private String name = "";
    private String detail = "";
    private String flavor = "";
    private String category = "";
    private String keySkill = "";
    private String componentCost = "";
    private String duration = "";
    private int level = 0;
    private String time = "";
    private String marketPrice = "";
    private String prerequisite = "";
    private String type = "";
    
    
    public Ritual(int id) {
	this.id = id;
    }

    public String getHTML() {
	// If we have flavor filled out then we have all we need to build our HTML from that.
	if (!flavor.equals("")) {
	    buildHTML();
	    return html;
	}
	
	if (id == 0)
	    return "";
	if (html == null) {
	    RitualCompendiumEntry com = new RitualCompendiumEntry(this);
	    html = com.getHTML();
	}
	return html;
    }

    public String toString() {
	return name;
    }

    public int getId() {
	return id;
    }

    public void setId(int id) {
	this.id = id;
    }

    public String getHtml() {
        return html;
    }

    public void setHtml(String html) {
        this.html = html;
    }

    public String getFlavor() {
        return flavor;
    }

    public void setFlavor(String flavor) {
        this.flavor = flavor;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getKeySkill() {
        return keySkill;
    }

    public void setKeySkill(String keySkill) {
        this.keySkill = keySkill;
    }

    public String getComponentCost() {
        return componentCost;
    }

    public void setComponentCost(String componentCost) {
        this.componentCost = componentCost;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(String marketPrice) {
        this.marketPrice = marketPrice;
    }

    public String getPrerequisite() {
        return prerequisite;
    }

    public void setPrerequisite(String prerequisite) {
        this.prerequisite = prerequisite;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
	return name;
    }

    public void setName(String name) {
	this.name = name;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    // buildHTML should only be called when we have flavor set up already
    // so return if that is not true
    private void buildHTML() {
	if (flavor.equals(""))  return;
	
	html="<div id=\"detail\">\n";

	html += "<h1 style=\"font:aerial;font-size:1.35em;font-weight: bold;line-height:2;padding-left:15px;margin:0;color:white;background: #1d3d5e;\" class=\"player\">"+name+"</h1><i>"+flavor+"</i><br/>\n";
	html += "<p><span class=\"ritualstats\"><b>Component Cost</b>: "+componentCost+"<br/>\n";
	html += "<b>Market Price</b>: "+marketPrice+"<br/>\n";
	html += "<b>Key Skill</b>: "+keySkill+"</span> <b>Level</b>: "+level+"<br/>\n";
	html += "<b>Category</b>: "+category+"<br/>\n";
	html += "<b>Time</b>: "+time+"<br/>\n";
	html += "<b>Duration</b>: "+duration+"</p>\n";
		
	html += "</div>";
    }
}
